package com.sumu.baidunuomi;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.widget.RadioGroup;

import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.location.LocationClientOption.LocationMode;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.sumu.fragment.HomeFragment;
import com.sumu.utils.AppConstants;
import com.sumu.utils.FragmentTabAdapter;
import com.sumu.utils.FragmentTabAdapter.OnRgsExtraCheckedChangedListener;

@ContentView(R.layout.activity_main)
public class MainActivity extends ActionBarActivity implements
		OnRgsExtraCheckedChangedListener {
	private List<Fragment> fragments = new ArrayList<Fragment>();
	@ViewInject(R.id.radiogoup)
	private RadioGroup radioGroup;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ViewUtils.inject(this);
		getSupportActionBar().hide();
		getFragments();

		FragmentTabAdapter adapter = new FragmentTabAdapter(
				getSupportFragmentManager(), fragments, R.id.fragment,
				radioGroup);
		adapter.setOnRgsExtraCheckedChangedListener(this);
	}

	private void getFragments() {
		// TODO Auto-generated method stub
		fragments.add(HomeFragment.getInstance(AppConstants.URL_HOME_LIKE));
		fragments.add(HomeFragment.getInstance(AppConstants.URL_HOME_LIKE));
		fragments.add(HomeFragment.getInstance(AppConstants.URL_HOME_LIKE));
		fragments.add(HomeFragment.getInstance(AppConstants.URL_HOME_LIKE));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void OnRgsExtraCheckedChanged(RadioGroup radioGroup, int checkedId,
			int index) {
		// TODO Auto-generated method stub

	}

}
